using UnityEngine;

public class SpawnerSmoke : MonoBehaviour
{
    public GameObject smokePrefab;
    public Transform spawnPoint;
    public Transform targetRoot;
    public float spawnDelay = 1.5f;
    private float time;

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        time += Time.deltaTime;
        if (time > spawnDelay)
        {
            Transform spawnParent = targetRoot == null ? LevelManager.Instance.spawnRoot : targetRoot;
            Instantiate(smokePrefab, spawnPoint.position, Quaternion.identity, spawnParent);
            time -= spawnDelay;
        }
    }
}
